package tt.lab.designparttern.visitor;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ToBeVisited tb = new ToBeVisited();

		// a named visitor
		Visitor visitor = new TestVisitor();
		tb.accept(visitor);
		
		System.out.println(tb);
		// another one
		tb.accept(new Visitor() {
			@Override
			public void visit(ToBeVisited tobe) {
				System.out.println("Test.main(...).new Visitor() {...}.visit(): ");
				//TB.accept(Visitor)
				// 		-> Vistor.visit();
				System.out.println(tobe);
			}
		});

	}

}
